<?php
// +----------------------------------------------------------------------
// | 海豚PHP框架 [ DolphinPHP ]
// +----------------------------------------------------------------------
// | 版权所有 2016~2017 河源市卓锐科技有限公司 [ http://www.zrthink.com ]
// +----------------------------------------------------------------------
// | 官方网站: http://dolphinphp.com
// +----------------------------------------------------------------------
// | 开源协议 ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------

namespace app\cms\admin;

use app\admin\controller\Admin;
use app\common\builder\ZBuilder;
use think\Cache;
use think\Db;
use app\cms\model\Vote as VoteModel;

/**
 * 投票管理
 */
class Vote extends Admin
{
    public function index(){
        cookie('__forward__', $_SERVER['REQUEST_URI']);
        $order = $this->getOrder('id DESC');
        $map   = $this->getMap();
        $data_list = VoteModel::getAll($map,$order);       
        return ZBuilder::make('table')
            ->addOrder('id')
            ->addColumns([ // 批量添加列
                ['id', 'ID'],
                ['issolve', '是否解决','status','',['否','是']],
                ['reason', '未解决原因'],
                ['content', '未解决内容'],
                ['ip', 'IP'],
                ['create_time', '投票时间'],
                ['right_button', '操作', 'btn']
            ])
            ->setTableName('vote')
            ->setPrimaryKey('id')
            ->addFilter('issolve', ['否','是'])
            ->addRightButton('delete')
            ->setRowList($data_list)
            ->fetch();
    }
}